/**
 * Copyright 2007 Igor Chaves Cananéa
 *
 * This file is part of PBSFW
 *
 * PBSFW is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * PBSFW is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef _STOP_TASK_H_
#define _STOP_TASK_H_

#include "task.h"
#include "process.h"
#include "memorylist.h"
#include "scheduler.h"

namespace pbsfw {
    class StopTask : public Task {
        private:
            USE_CMM(StopTask)

            class StopProcess : public Process {
                public:
                    StopProcess() : Process("The Stop Process") {}
                    void run() {}
            };

            Scheduler &sched;

        public:
            StopTask(Scheduler &sched, simtime_t at)
                : Task(*new StopProcess(), at), sched(sched) {}

            void run() {
                this->sched.reset();
            }

            ~StopTask() {
                delete this->p;
            }
    };
};

#endif
